package cn.tedu.micro.demo.stock.controller;

import cn.tedu.micro.demo.common.protocol.JsonResult;
import cn.tedu.micro.demo.stock.service.StockService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/stock")
public class StockController {
    @Autowired
    private StockService stockService;

    @PostMapping("update")
    public JsonResult<Void> updateStock(@RequestParam("productCode") String productCode, @RequestParam("count") Integer count) {
        stockService.updateStock(productCode, count);
        return JsonResult.ok("ok", null);
    }
}
